package practica4;

import java.util.Random;

import weka.classifiers.Evaluation;
import weka.classifiers.trees.J48;
import weka.core.Instances;

public class ScanParamsJ48 {
	
	public ScanParamsJ48(){
	}

	public void barrerParamsJ48(Instances data) throws Exception{ 
		
		double fmeasure=-1,fmeasureMax=-1;
		Evaluation evaluator = null;

		for(int b=1;b<data.numInstances();b++){ 
			
			J48 estimador = new J48();
			evaluator = new Evaluation(data);
			evaluator.crossValidateModel(estimador, data, 10, new Random(45)); 
			fmeasure =evaluator.weightedFMeasure();

	
			if(fmeasure>fmeasureMax){
				fmeasureMax = fmeasure;				
			}
		}
		System.out.println("f-measure correspondiente = " + fmeasureMax);
		System.out.println(evaluator.toClassDetailsString());
		System.out.println(evaluator.toSummaryString());
		System.out.println(evaluator.toMatrixString());
		
	}
	
}
